package com.example.zhugenew.MVP.presenter;

import com.example.zhugenew.MVP.model.IModel;
import com.example.zhugenew.MVP.view.IView;
import com.example.zhugenew.bean.newhouses.NewHouseBlockBean;
import com.example.zhugenew.bean.newhouses.NewHouseEvidenceBean;
import com.example.zhugenew.bean.newhouses.NewHouseHotListBean;
import com.example.zhugenew.bean.newhouses.NewHouseImageBean;
import com.example.zhugenew.bean.newhouses.NewListBean;

public class IPrensenter {
    private IView iView;
    private final IModel iModel;

    public IPrensenter(IView iView) {
        this.iView = iView;
        iModel = new IModel();
    }

    public void getBlockData() {
        iModel.getBlockData(new ICallBack<NewHouseBlockBean>() {
            @Override
            public void OnSuccess(NewHouseBlockBean newHouseBlockBean) {
                iView.blockSuccess(newHouseBlockBean);
            }

            @Override
            public void OnFailed(String error) {
                iView.showError(error);
            }
        });
    }

    public void getImageData() {
        iModel.getImageData(new ICallBack<NewHouseImageBean>() {
            @Override
            public void OnSuccess(NewHouseImageBean newHouseImageBean) {
                iView.imageSuccess(newHouseImageBean);
            }

            @Override
            public void OnFailed(String error) {
                iView.showError(error);
            }
        });
    }

    public void getEvidenceData() {
        iModel.getEvidenceData(new ICallBack<NewHouseEvidenceBean>() {
            @Override
            public void OnSuccess(NewHouseEvidenceBean newHouseEvidenceBean) {
                iView.evidenceSuccess(newHouseEvidenceBean);
            }

            @Override
            public void OnFailed(String error) {

                iView.showError(error);
            }
        });
    }

    public void getHotlistData() {
        iModel.getHotListData(new ICallBack<NewHouseHotListBean>() {
            @Override
            public void OnSuccess(NewHouseHotListBean newHouseHotListBean) {
                iView.hotlistSuccess(newHouseHotListBean);
            }

            @Override
            public void OnFailed(String error) {
                iView.showError(error);

            }
        });
    }

    public void getNewListData() {
        iModel.getHousesList(new ICallBack<NewListBean.DataBeanX>() {
            @Override
            public void OnSuccess(NewListBean.DataBeanX dataBeanX) {
                iView.newlistSuccess(dataBeanX);
            }

            @Override
            public void OnFailed(String error) {
                iView.showError(error);
            }
        });
    }
}
 